# app/models.py
from . import db  # 使用相对导入

class KnowledgeItem(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    title = db.Column(db.String(100), nullable=False)
    content = db.Column(db.Text, nullable=False)

class SentimentAnalysisResult(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    text = db.Column(db.Text, nullable=False)
    pos_probability = db.Column(db.Float)
    neg_probability = db.Column(db.Float)
    neutral_probability = db.Column(db.Float)

    def __repr__(self):
        return f'<SentimentAnalysisResult {self.id}>'
